package com.elec.controller;

import com.elec.domain.R;
import com.elec.domain.entity.User;
import com.elec.service.UserService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author yu
 * @date 2024/7/7
 */
@RestController
public class LoginController {
    @Resource
    private UserService userService;
    @PostMapping("login")
    public R login(@RequestBody User user){
        return userService.login(user);
    }
    @PostMapping("register")
    public R register(@RequestBody User user){
        return userService.register(user);
    }
}
